/* SPDX-License-Identifier: GPL-2.0*/
/****************************************************************************
 * nand_cfg.c for  SUNXI NAND .
 *
 * Copyright (C) 2016 Allwinner.
 *
 *
 * This file is licensed under the terms of the GNU General Public
 * License version 2.  This program is licensed "as is" without any
 * warranty of any kind, whether express or implied.
 ****************************************************************************/
#include "rawnand_cfg.h"

struct nand_cfg *g_phy_cfg;

#if 0
#define PHY_ONLY_TOG_AND_SDR 1

#define PHY_WAIT_RB_BEFORE 1
#define PHY_WAIT_RB_INTERRUPT 1
#define PHY_WAIT_DMA_INTERRUPT ((wait_dma_int == 1) ? 1 : 0)
#endif
/****************************************************************************
*Single channel needs to be affixed to the same kind of flash
*Dual channel needs to be affixed to  the same number and type of flash
*
*Single channel
*1.support two-plane
*2.support vertical_interleave
*3.if superpage>32k two-plane not supported
*4.vertical_interleave chip pairing with different rb in the channel
*
*Dual channel
*1.support two-plane
*2.support dual_channel
*3.support vertical_interleave
*4.if superpage>32k two-plane not supported
*5.dual_channel chip pairing with same chip number between the channel
86.vertical_interleave chip pairing with different rb in the channel
*****************************************************************************/
#define PHY_SUPPORT_TWO_PLANE 1
#define PHY_SUPPORT_VERTICAL_INTERLEAVE 1
#define PHY_SUPPORT_DUAL_CHANNEL 1

/****************************************************************************
*Name         :
*Description  :
*Parameter    :
*Return       :
*Note         :
*****************************************************************************/
int nand_cfg_interface(void)
{
	return PHY_ONLY_TOG_AND_SDR ? 1 : 0;
}

/****************************************************************************
*Name         :
*Description  :
*Parameter    :
*Return       :
*Note         :
*****************************************************************************/
int nand_wait_rb_before(void)
{
	return PHY_WAIT_RB_BEFORE ? 1 : 0;
}

/****************************************************************************
*Name         :
*Description  :
*Parameter    :
*Return       :
*Note         :
*****************************************************************************/
int nand_wait_rb_mode(void)
{
	return PHY_WAIT_RB_INTERRUPT ? 1 : 0;
}

/****************************************************************************
*Name         :
*Description  :
*Parameter    :
*Return       :
*Note         :
*****************************************************************************/
int nand_wait_dma_mode(void)
{
	return PHY_WAIT_DMA_INTERRUPT ? 1 : 0;
}

/****************************************************************************
*Name         :
*Description  :
*Parameter    :
*Return       :
*Note         :
*****************************************************************************/
int nand_support_two_plane(void)
{
	return PHY_SUPPORT_TWO_PLANE ? 1 : 0;
}

/****************************************************************************
*Name         :
*Description  :
*Parameter    :
*Return       :
*Note         :
*****************************************************************************/
int nand_support_vertical_interleave(void)
{
	return PHY_SUPPORT_VERTICAL_INTERLEAVE ? 1 : 0;
}

/****************************************************************************
*Name         :
*Description  :
*Parameter    :
*Return       :
*Note         :
*****************************************************************************/
int nand_support_dual_channel(void)
{
	return PHY_SUPPORT_DUAL_CHANNEL ? 1 : 0;
}
